package scrum.gui.help;

import javax.swing.event.TreeModelEvent;
import javax.swing.event.TreeModelListener;
import javax.swing.tree.DefaultMutableTreeNode;

public class MyTreeModelListener implements TreeModelListener {

	
	public void treeNodesChanged(TreeModelEvent e) {
		 DefaultMutableTreeNode node;
         node = (DefaultMutableTreeNode)
                  (e.getTreePath().getLastPathComponent());

         /*
          * If the event lists children, then the changed
          * node is the child of the node we've already
          * gotten.  Otherwise, the changed node and the
          * specified node are the same.
          */
         try {
             int index = e.getChildIndices()[0];
             node = (DefaultMutableTreeNode)
                    (node.getChildAt(index));
         } catch (NullPointerException exc) {}

         System.out.println("The user has finished editing the node.");
         System.out.println("New value: " + node.getUserObject());
		
	}

	
	public void treeNodesInserted(TreeModelEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	
	public void treeNodesRemoved(TreeModelEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	
	public void treeStructureChanged(TreeModelEvent arg0) {
		// TODO Auto-generated method stub
		
	}

}
